package com.fuze.potryservice.mapper;

import com.fuze.entity.Poem;
import com.fuze.vo.DynatryPoemResultVO;
import com.fuze.vo.PoemDataVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PotryMapper {
    @Select("select count(*) from poem.potry")
    Integer getcount();

    @Select("select title from poem.potry")
    List<String> GetAllPoemName();

    @Select("select *  from poem.potry where id=#{id}")
    Poem GetContentById(Integer id);

    @Select("select distinct dynasty from poem.potry")
    List<String> Getdynasty();

    List<DynatryPoemResultVO> GetDynastyPoemResulVo();

    @Select("select id,title,writer,content,type from poem.potry where dynasty=#{dynasty}")
    List<PoemDataVo> GetPoemDataVoByDynasty(String dynasty);
    @Select("select id,title,writer,content,type from poem.potry order by rand() limit 10")
    List<PoemDataVo> GetPoemDateRondom();
}
